package com.dabaozhan.modules.wx_app.service.impl;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.SiteIndustryMapper;
import com.dabaozhan.modules.wx_app.entity.SiteIndustryEntity;
import com.dabaozhan.modules.wx_app.service.SiteIndustryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author houzhong
 * @date 2019-01-09 15:19
 */
@Service("siteIndustryService")
public class SiteIndustryServiceImpl implements SiteIndustryService {

    @Autowired
    private SiteIndustryMapper siteIndustryMapper;

    @Override
    public int saveSiteIndustry(SiteIndustryEntity v) {
        if (v.getId() == null) {
            v.setId(Utils.id().toString());
        }
        return siteIndustryMapper.save(v);
    }

    @Override
    public int updateSiteIndustry(SiteIndustryEntity v) {
        return siteIndustryMapper.update(v);
    }

    @Override
    public SiteIndustryEntity findByUserId(String userId) {
        return siteIndustryMapper.findByUserId(userId);
    }

    @Override
    public SiteIndustryEntity findByCertificatesUserId(String userId) {
        return siteIndustryMapper.findByCertificatesUserId(userId);
    }
}
